class Solution(object):
    def maxOperations(self, s):
        """
        :type s: str
        :rtype: int
        """
        n=len(s)
        t=0
        ans=0
        for i in range(n-1):
            if s[i]=='1':
                t+=1
                if s[i+1]=='0':
                    ans+=t
        return ans

